package opp.Pplymorhic;

public class Cat extends Animal{
    int nums=0;

    public Cat(int nums) {
        this.nums = nums;
    }

    public int getNums() {
        return nums;
    }

    public void setNums(int nums) {
        this.nums = nums;
    }

    @Override
    double eating(int fish) {
        int i=0;
        if(nums<=2){

            System.out.println("猫吃了"+nums+"条鱼");
            i=fish-nums;
            System.out.println("剩下"+i+"条鱼");
        }else {
            i=fish-nums;
            System.out.println("鱼太多了，猫没吃完,剩余"+i+"条鱼");
        }
        return i;
    }
}
